package com.xzzz.irda.tracker.core.adapter.feign;

import com.xzzz.irda.tracker.core.TrackerUtil;
import com.xzzz.irda.tracker.core.common.TrackerConstants;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import lombok.extern.slf4j.Slf4j;

import javax.annotation.PostConstruct;

@Slf4j
public class TrackerFeignInterceptor implements RequestInterceptor {

    @Override
    public void apply(RequestTemplate template) {
        template.header(TrackerConstants.HTTP_HEADERS, TrackerUtil.buildHeader(TrackerConstants.SPAN_TYPE_HTTP_FEIGN_INVOKE));
    }

    @PostConstruct
    public void init() {
        log.info("[TRACKERS] 已适配 FEIGN INTERCEPTOR");
    }
}
